{include file="public/head"/}
<body>
<div class="x-nav">
      <span class="layui-breadcrumb">
        <a><cite>后台管理</cite></a>
        <a><cite>停车场地管理中心</cite></a>
        <a><cite>停车账单管理</cite></a>
      </span>
  <a class="layui-btn layui-btn-small" style="line-height:1.6em;margin-top:3px;float:right" href="javascript:window.location.reload();" title="刷新">
    <i class="layui-icon" style="line-height:30px">ဂ</i></a>
</div>
<div class="x-body">
  <div class="layui-row">
    <form class="layui-form layui-col-md12 x-so"  method="get" action="#">
      <div class="layui-input-inline">
        <select name="parkingNo" lay-filter="parkingNo" id="parkingNo">
          <option value="">所属停车场</option>
          {foreach $parkinglist as $parking}
          <option value="{$parking.parkingNo}" {if isset($parkingNo)}{if $parkingNo == $parking.parkingNo} selected {/if}{/if}>{$parking.parkingName}</option>
          {/foreach}
        </select>
      </div>
      <div class="layui-input-inline">
        <select name="clientNo" lay-filter="clientList" id="clientNo">
          <option value="">客户端</option>
          {foreach $clientList as $clientinfo}
          <option value="{$clientinfo.clientNo}" {if isset($clientNo)}{if $clientNo == $clientinfo.clientNo} selected {/if}{/if}>{$clientinfo.clientName}</option>
          {/foreach}
        </select>
      </div>

      <input type="text" name="carPlateNo"  placeholder="车牌号码" autocomplete="off" class="layui-input" value="{if isset($carPlateNo)}{$carPlateNo}{/if}">

      <div class="layui-input-inline">
        <select name="payType">
          <option value="">付款方式</option>
          <option value="1" {if isset($payType)}{if $payType == '1'}selected{/if}{/if}>支付宝扫码</option>

          <option value="8" {if isset($payType)}{if $payType == '8'}selected{/if}{/if}>支付宝预交费</option>



          <option value="4" {if isset($payType)}{if $payType == '4'}selected{/if}{/if}>城市大脑扣款</option>
          <option value="5" {if isset($payType)}{if $payType == '5'}selected{/if}{/if}>支付宝代扣</option>


        </select>
      </div>

      <input type="text" class="layui-input" id="test5" name="start_time" placeholder="开始时间" {if isset($start_time)}value="{$start_time}"{/if}>
      <input type="text" class="layui-input" id="test6" name="end_time" placeholder="结束时间" {if isset($end_time)}value="{$end_time}"{/if}>
      <button class="layui-btn"  lay-submit="" lay-filter="sreach"><i class="layui-icon">&#xe615;</i></button>
      <!-- <button type="reset" class="layui-btn"><i class="layui-icon">&#xe639;</i></button> -->
    </form>
  </div>
  <xblock>
    <button class="layui-btn" onclick="orderDump('{$export}')"><i class="layui-icon"></i>批量导出</button>&nbsp;&nbsp;&nbsp;&nbsp;
    支付宝代扣:<input type="text" class="layui-input" style="width:8%;display:inline-block;border-radius:5px;background:#0099CC;color:white" readonly value=""/> &nbsp;&nbsp;&nbsp;&nbsp;
    支付宝扫码:<input type="text" class="layui-input" style="width:8%;display:inline-block;border-radius:5px;border-radius:5px;background:#9933CC;color:white" readonly value="{$money.ali/100}"/> &nbsp;&nbsp;&nbsp;&nbsp;


     &nbsp;&nbsp;&nbsp;&nbsp;
    <span class="x-right" style="line-height:40px">共有数据：{$number} 条</span>
  </xblock>
  <table class="layui-table">
    <thead>
    <tr>

      <th style="text-align: center; font-size: 16px; height: 30px;">ID</th>
      <th style="text-align: center; font-size: 16px;">停车场</th>
      <th style="text-align: center; font-size: 16px;">客户端</th>
      <th style="text-align: center; font-size: 16px;">车牌号码</th>
      <th style="text-align: center; font-size: 16px;">应收金额</th>
      <th style="text-align: center; font-size: 16px;">实收金额</th>
      <th style="text-align: center; font-size: 16px;">付款方式</th>
      <th style="text-align: center; font-size: 16px;">付款状态</th>
      <th style="text-align: center; font-size: 16px;">缴费时间</th>
      <th style="text-align: center; font-size: 16px;">入场时间</th>
      <th style="text-align: center; font-size: 16px;">出场时间</th>
      <th style="text-align: center; font-size: 16px;">停车时长</th>
      {if $usertype == 0}
      <th style="text-align: center; font-size: 16px;">操作</th>
      {/if}

    </tr>
    </thead>
    <tbody>
    {foreach $list as $lis}
    <tr>

      <td style="text-align: center;">{$lis.order_id}</td>
      <td style="text-align: center;">{$lis.parkingNo}</td>
      <td style="text-align: center;">{$lis.clientName}</td>
      <td style="text-align: center;">{$lis.carPlateNo}</td>
      <td style="text-align: center;">{$lis.amountDue/100}</td>

      <td style="text-align: center;">{$lis.amountRec/100}</td>
      <td style="text-align: center;">
        {if $lis.payType=="1"}支付宝扫码{/if}
        {if $lis.payType=="2"}微信扫码{/if}
        {if $lis.payType=="3"}优惠券{/if}
        {if $lis.payType=="4"}城市大脑扣款{/if}
        {if $lis.payType=="5"}支付宝代扣{/if}
        {if $lis.payType=="6"}储值车{/if}
        {if $lis.payType=="7"}福利车{/if}
        {if $lis.payType=="8"}支付宝预交费{/if}
        {if $lis.payType=="9"}微预预交费{/if}
        {if $lis.payType=="10"}停车优惠券{/if}
        {if $lis.payType=="cash"}现金{/if}
      </td>
      <td style="text-align: center;">
        {if $lis.orderstatus=="SUCCESS"}收款成功{/if}
        {if $lis.orderstatus=="WAIT"}<span style="color:red">未收款</span>{/if}

      </td>
      <td style="text-align: center;">
        {if $lis.paytime != 0}
        {$lis.paytime|strtotime|date="Y-m-d H:i:s"}
        {/if}
      </td>
      <td style="text-align: center;">
        {if $lis.parkingStartTime != 0}
        {$lis.parkingStartTime|strtotime|date="Y-m-d H:i:s"}
        {/if}
      </td>
      <td style="text-align: center;">
        {if $lis.parkingEndTime != 0}
        {$lis.parkingEndTime|strtotime|date="Y-m-d H:i:s"}
        {/if}
      </td>

      <td style="text-align: center;">

        {$lis.parkingTime|ctime}

      </td>

      {if $usertype == 0}
      <td class="td-manage" style="text-align: center;">
        <a title="删除" onclick="orderDel('{$lis.order_id}','{$lis.order_id}')" href="javascript:;" id="{$lis.order_id}">
          <i class="layui-icon">&#xe640;</i>
        </a>
      </td>
      {/if}

    </tr>
    {/foreach}
    </tbody>
  </table>
  <div class="page">
    <div>
      {$orderlist->render()|raw}
    </div>
  </div>

</div>
<script>
    layui.use(['form'], function() {
        form=layui.form;
        form.on('select(parkingNo)', function(data){
            var val=data.value;
            console.log(val);
            if(val==""){
                $('#clientNo').html("<option value=''>客户端</option>");
                form.render('select')
            }else{
                var url = "{:url('order/getClient')}"
                $.post(url, {parkingNo:val}, function(res) {
                    console.log(res);
                    $('#clientNo').html(res);
                    form.render('select')
                },'html')
            }
        });
    })
    layui.use('laydate', function() {
        var laydate = layui.laydate;
        //日期时间选择器
        laydate.render({
            elem: '#test5'
            ,type: 'datetime'
        });
        //日期时间选择器
        laydate.render({
            elem: '#test6'
            ,type: 'datetime'
        });
    });
    //删除
    function orderDel(id, doc){
        if(confirm('确定要删除吗?'))
        {
            var url = "{:url('orderDel')}?id=" + id
            // console.log(url)
            $('#' + doc).attr('href', url)
        }
        return false;
    }

    //批量导出
    function orderDump(exportid){
        var url = "{:url('orderExcel')}?&export=" + exportid;
        layer.open({
            type: 2,
            title: '批量导出账单',
            shadeClose: true,
            shade: 0.8,
            area: ['60%', '60%'],
            content: url //iframe的url
        });
    }

</script>
<script>var _hmt = _hmt || []; (function() {
    var hm = document.createElement("script");
    hm.src = "https://hm.baidu.com/hm.js?b393d153aeb26b46e9431fabaf0f6190";
    var s = document.getElementsByTagName("script")[0];
    s.parentNode.insertBefore(hm, s);
})();
</script>
</body>

</html>